#include <bits/stdc++.h>

using namespace std;

struct Date
{
    int year;
    int month;
    int day;
};
const int monthDay[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int getMonthDay(int year, int month)
{
    if (isLearYear(year) && month == 2)
    {
        return 29;
    }
    return monthDay[month];
}

bool isLearYear(int a)
{
    if (a % 4 == 0 && a % 100 != 0 || a % 400 == 0)
    {
        return true;
    }
    return false;
}

bool isprime(int i)
{
    if (i == 2 || i == 3 || i == 5 || i == 7 || i == 11)
    {
        return true;
    }
    return false;
}

int main()
{
    int year, month, day;
    while (cin >> year >> month >> day)
    {
        Date from = {year, month, day};
        cin >> year >> month >> day;
        Date to = {year, month, day};
        int ret = 0;
        for (int i = from.year; i < to.year; ++i)
        {
            if (isLearYear(i))
            {
                ret += 580;
            }
            else
            {
                ret += 579;
            }
        }
        int i = from.month;
        if (from.year < to.year)
        {
            i = 1;
        }
        for (; i < to.month; ++i)
        {
            if (isprime(i))
            {
                ret += getMonthDay(to.year, i);
            }
            else
            {
                ret += getMonthDay(to.year, i) * 2;
            }
        }
        int j = from.day;
        if (from.year < to.year || from.month < to.month)
        {
            j = 1;
        }
        if (isprime(to.month))
        {
            ret += to.day - j + 1;
        }
        else
            ret += (to.day - j + 1) * 2;
        cout << ret << endl;
    }
    return 0;
}